package com.woniuxy.api;

import com.woniu.cloud.common.dto.Result;
import com.woniuxy.form.GetAfterSaleByPlatform;
import com.woniuxy.form.InsertAfterSale;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "kaer-order",contextId = "AfterSaleApi")
public interface AfterSaleApi {


    /**
     *
     * @param afterSaleId  售后id
     * @param status  状态码  1.未完成   2.已完成   3.不能售后
     * @return bool
     *
     * 平台修改修改商品订单的售后状态
     */
    @PutMapping("/updateAfterSaleById")
    @GlobalTransactional
    Result updateAfterSaleById(@RequestParam("afterSaleId") Integer afterSaleId ,@RequestParam("status") Integer status);


    /**
     *
     * @param pageSize 总页数　
     * @param indexPage　当前页
     * @return　Iｐａｇｅ
     *
     * 用户查看商品订单的售后订单详情
     */
    @GetMapping("/getAfterSaleByUserId")
    @GlobalTransactional
    Result getAfterSaleByUserId(@RequestParam("indexPage") Integer indexPage,@RequestParam("pageSize") Integer pageSize,@RequestParam("userId") Integer userId);

    /**
     *
     * @return
     *
     * 平台查看售后订单详情
     */
    @GetMapping("/getAfterSaleByPlatform")
    @GlobalTransactional
    Result getAfterSaleByPlatform(@RequestBody GetAfterSaleByPlatform getAfterSaleByPlatform);

    /**
     *
     * @param insertAfterSale
     * @return
     *
     * 用户申请售后  插入售后记录   同时更改订单状态
     */
    @PostMapping("/insertAfterSale")
    @GlobalTransactional
    Result insertAfterSale(@RequestBody InsertAfterSale insertAfterSale);


    /**
     *
     * @param getAfterSaleByPlatform 页数
     * @return
     *
     * 店铺查看售后订单详情
     */
    @GetMapping("/getAfterSaleByStore")
    @GlobalTransactional
    Result getAfterSaleByStore(@RequestBody GetAfterSaleByPlatform getAfterSaleByPlatform);

    /**
     *
     * @param afterSaleId   售后Id
     * @return
     *
     * 平台或者店铺 来查询某个售后记录
     *
     */
    @GetMapping("/getAfterSaleById")
    @GlobalTransactional
    Result getAfterSaleById(@RequestParam("afterSaleId") Integer afterSaleId);


}
